using Tatibah;

namespace Styles
{
	// See the DocumetAPI.PDF for the results
	class Program
	{
		static void Main(string[] args)
		{
			// Create the document
            Document document = new Document(@"C:\Tatibah\Results\Style.docx");

			//Create the Style
            Style myStyle1 = new Style("myStyle1");
			myStyle1.Bold = true;
			myStyle1.UnderLine = true;
			myStyle1.UnderLineColour = Document.ColourToHex(System.Drawing.Color.Red);

			// Create a Paragraph
            Paragraph p = new Paragraph("This paragraph has been styled. Add a non styled ");
			p.Append(new Run("word.") { UnderLine = false, Bold = false });
			// Assign the Style to the Paragraph
            p.Style = myStyle1;
			// Add the Paragraph to the Document
            document.Append(p);

			// Create a new Style in one statement
            Style myStyle2 = new Style("MyStyle2")
			{
				LeftIndentation = Document.cmsToDxa(2),
                RightIndentation = Document.cmsToDxa(2),
                HangingIndentation = Document.cmsToDxa(1)
			};

			// Append a Paragraph to the Document and assign a Style to it
            document.Append(
                new Paragraph(
                        "No one would have believed in the last years of the nineteenth " +
                        "century that this world was being watched keenly and closely by " +
                        "intelligences greater than man's and yet as mortal as his own; that as " +
                        "men busied themselves about their various concerns they were " +
                        "scrutinised and studied, perhaps almost as narrowly as a man with a " +
                        "microscope might scrutinise the transient creatures that swarm and " +
                        "multiply in a drop of water.")
						{ Style = myStyle2 }
                );

            // Save the Document
            document.Save();
            document.Close();
        }
    }
}
